package com.yl.users.mapper

import com.baomidou.mybatisplus.core.mapper.BaseMapper
import com.yl.users.entity.SysPermissions
import com.yl.users.pojo.dto.CompanyPermissionsDto
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param
@Mapper
interface SysPermissionsMapper : BaseMapper<SysPermissions> {


    /**
     * 查询所有学校用的权限
     */
    fun selectAllPermissionsList(): MutableList<CompanyPermissionsDto>

    /**
     * 通过 sys_company_permissions 查询已有的菜单权限
     * @param companyId
     * @return
     */
    fun selectCompanyAllPermissions(@Param("companyId") companyId: Long): List<SysPermissions>

    /**
     * 删除该公司多余的角色-权限关联
     * @param companyId
     */
    fun delByCompanyPermissions(@Param("companyId") companyId: Long?)

    /**
     * 查询是否存在相同的code
     */
    fun selectCountByCode(permissions: SysPermissions): Int
}